class WimpsController < ApplicationController
  # GET /wimps
  # GET /wimps.xml
  def index
    @wimps = Wimp.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @wimps }
    end
  end

  # GET /wimps/1
  # GET /wimps/1.xml
  def show
    @wimp = Wimp.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @wimp }
    end
  end

  # GET /wimps/new
  # GET /wimps/new.xml
  def new
    @wimp = Wimp.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @wimp }
    end
  end

  # GET /wimps/1/edit
  def edit
    @wimp = Wimp.find(params[:id])
  end

  # POST /wimps
  # POST /wimps.xml
  def create
    @wimp = Wimp.new(params[:wimp])

    respond_to do |format|
      if @wimp.save
        flash[:notice] = 'Wimp was successfully created.'
        format.html { redirect_to(@wimp) }
        format.xml  { render :xml => @wimp, :status => :created, :location => @wimp }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @wimp.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /wimps/1
  # PUT /wimps/1.xml
  def update
    @wimp = Wimp.find(params[:id])

    respond_to do |format|
      if @wimp.update_attributes(params[:wimp])
        flash[:notice] = 'Wimp was successfully updated.'
        format.html { redirect_to(@wimp) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @wimp.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /wimps/1
  # DELETE /wimps/1.xml
  def destroy
    @wimp = Wimp.find(params[:id])
    @wimp.destroy

    respond_to do |format|
      format.html { redirect_to(wimps_url) }
      format.xml  { head :ok }
    end
  end
end
